package com.xyhy.core.jackson.type;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.core.type.TypeReference;
import com.xyhy.core.jackson.JacksonMapper;

public class MapTypeReference<K, V> extends TypeReference<Map<K, V>> {
  protected final Type type;

  public MapTypeReference(Class<K> kClass, Class<V> vClass) {
    type = JacksonMapper.instance.objectMapper.getTypeFactory().constructParametricType(HashMap.class, kClass,
            vClass);
  }

  @Override
  public Type getType() {
    return type;
  }
}
